Repository navigation
OpenSSH 10.4p1 uplift - #198
andrewyounkers wants to merge 200 commits into
Conversation
This was missed after the file was updated, but nobody noticed it until now.
-> uintXX_t OpenBSD-Commit-ID: 6d5e80bd6f29a9db18b18beeb1cbe5423b59de44
~I escape OK dtucker@ OpenBSD-Commit-ID: 695c1a09c4cc8b417a1bd3eb207b0cc7fa831c7a
Fixes interactive vs bulk IPQoS for client->server traffic. ok job@ OpenBSD-Commit-ID: 34f5131face8d6dc4ae6955196e5fcafb3570cfe
OpenSSL 4 removes support for ENGINE, but it provides no-op stubs for the ENGINE functions in addition to setting OPENSSL_NO_ENGINE. The presence of the stubs fooled the old configure test, so if someone tried --with-ssl-engine with OpenSSL 4.0.0 it'd try but fail at build time. Explicitly check for OPENSSL_NO_ENGINE. before trying to enable ENGINE support. bz#3952.
Recently Cygwin imported changes from Fedora which disable SHA1 signatures by default. This breaks the unit tests (and a couple of regression tests), so set rh-allow-sha1-signatures=yes in the OpenSSL config to re-enable them.
On sparc64 ssh/unittests/kex fails to build with: usr.bin/ssh/libcrux_mlkem768_sha3.h:8196: warning: inlining failed in call to 'libcrux_ml_kem_polynomial_ZERO_89_ea': --param max-inline-insns-single limit reached OK djm@ (long time ago) reminded by tb@ OpenBSD-Regress-ID: c32094e3436536474039a4aeefabdbf0bd826554
sshd_config instead of supported key types, which is almost but not completely correct. OpenBSD-Regress-ID: 43c3b348576900f3e710bff5d6a87f0e803c5b3d
channels does OK djm@ OpenBSD-Commit-ID: fa035fb19b74571992fa3adca4396a4c572a7a8a
so it can be cleaned up at exit. Reported by / tested by David Krause, ok markus@ OpenBSD-Commit-ID: b45d740e9a63dec0fad436ed78f6912b39f0cd53
fortify warnings on android. bz3954 OpenBSD-Commit-ID: 82224426b2ee989c68f305caa50aa3d3b4993a84
Add missing SSHD_CONFOPTS="UsePam yes" to the solaris PAM test step so it actually tests PAM functionality instead of re-running the default tests with a PAM-enabled binary.
we don't use the in OpenSSH and some compilers throw warnings compiling them that break -Werror
There's no point rerunning unit tests.
- Set up and run tests with SUDO. - Set random password to use for password & kbdint auth tests. - Only run t-exec when re-testing with PAM, don't rerun unit tests. - When testing PAM builds, test with and without UsePAM.
problems 1) Remove an early failure return for GSSAPI authentication attempts made for invalid accounts that yielded different behaviour for valid vs invalid accounts. 2) Fix a situation where some GSSAPI requestes were not correctly subjected to MaxAuthTries. 3) Fix a moderate pre-authentication resource DoS related to #2. Add missing logging for error cases. Report and fixes from Manfred Kaiser, milCERT AT OpenBSD-Commit-ID: ca0acdd64eea435d6f89534538a9eb404a5629d3
OpenBSD-Commit-ID: ce7b0749e5139c70410ee92a13d368d7d34262b5
refactoring servconf.c bz3974 patch from Colin Watson OpenBSD-Commit-ID: be39ad3dbe36d9ecdb86f3811da5dfbdc9bcb1e6
This is documented to be allowed, and was up until 10.4p1 when a transcription error in the config handling rework reverted it to global-only, ie not allowed inside Match. bz#3987.
Signed-off-by: Andrew Younkers <ayounkers44@gmail.com>
Signed-off-by: Andrew Younkers <ayounkers44@gmail.com>
Signed-off-by: Andrew Younkers <ayounkers44@gmail.com>
Signed-off-by: Andrew Younkers <ayounkers44@gmail.com>
Thanks for pointing this out @andrewyounkers ! This in my eyes is a statement and stance that surprises me: Can you point to such instances? What's your personal thought around this: Are you of the opinion that OQS has the resources and development principles allowing it to replace (presumably) well-maintained upstream code? fwiw, in On the alg itself,
allow me to ask the question what this update then removes from the upstream: The complete crypto, i.e., also an ML-DSA from the upstream, or just the hybrid-ization, i.e., ML-DSA still comes from the upstream? If the former, are there no other hybrids (that then would differ in terms of where the PQ logic comes from)? FWIW, for All told, I see the principle
highly skeptical and wouldn't follow it nor approve a PR doing so. Good I have not been asked to do so :-). So just take this statement as a correction of possibly committed prior crimes (should I have set the precedent you mentioned above of rejecting upstream OpenSSH hybrid PQ algorithms: I am willing to stand corrected when I see I made mistakes). |
The two examples that I was referencing were I am personally of the opinion to prefer the upstream code for the reason you mentioned of it being well-maintained code. I am willing to swap these algorithms to the OpenSSH implementation in this PR for all the reasons you provided above and carry on with the precedent set by the
This update doesn't replace the complete crypto implementation of
I do think the same approach of the hybrid provider would be worthwhile here especially as more PQ algorithms become supported by OpenSSH. I can make an issue for tracking this feature in the long-term. Moving forward until that is implemented, I think it is best to prefer the upstream algorithm when OpenSSH makes one available.
Thank you @baentsch for the thoughtful comments, I hope this addressed your questions but will be able to further discuss if there is a follow-up. I will include a reply to the last section in a new comment as my response is a bit long - sorry :-) |
|
@baentsch In regards to the comments around " Accept current to preserve OQS specific logic", I would like to clarify what I meant by that bullet point and seek guidance for the future. When resolving merge conflicts my priority is to always bring in the new upstream code first. If there is OQS specific logic that after investigating needs to be kept, I bring in a combination of the changes to get the incoming logic without breaking the OQS specific logic in place. I will note there are not very many of these cases. Majority of the merge conflicts that I have experienced during the uplifts come from OQS code surrounded by With this explanation does it alleviate any of your concerns? If this still is troubling is there a better process that I can follow in future uplifts? I apologize for not being more clear in my description, and will include more thorough explanations of the merge conflict resolution process in future uplift PRs. |
This commit addresses PR comments in open-quantum-safe#198. The changes here are to remove OQS implementations and generation of sntrup761x25519-sha512@openssh.com and mlkem768x25519-sha256 in favor of the upstream OpenSSH's implementaion of these algorithms. Signed-off-by: Andrew Younkers <ayounkers44@gmail.com>
|
@baentsch Not trying to rush, just hoping to make sure this is appearing in your inbox after our conversation earlier this week. Thank you! |
|
Apologies @andrewyounkers , this indeed dropped off my radar. So here we go:
Thanks very much: That'd be great.
Both perfectly sensible and in line with my thinking.
Yes, it does. Thanks! Please let me know when I should review the key files I can meaningfully review (README and testing logic). |
|
@baentsch thank you for your reply. I have created issue #199 for a future effort to support the hybrid-provider in OQS-SSH. All files in this PR are ready for review now. The README has a small amount of changes but will need review to ensure the wording about support for upstream PQ algorithms aligns with the OQS project. There were no test changes required besides new upstream code being merged in, but I have verified all upstream supported PQ algorithms are being tested in the CI run. Commit 31f2cc0 is the other area I would identify for meaningful review. No upstream changes from the uplift drove changes in OQS-SSH besides what is represented in this commit. Commit 1dc4dc1 contains all merge conflict resolutions, but as mentioned above this is mostly just preserving OQS code surrounded by |
baentsch
left a comment
There was a problem hiding this comment.
Mostly questions on this commit
| #endif /* OPENSSL_HAS_ECC */ | ||
| #endif /* WITH_OPENSSL */ | ||
| server2->kex->kex[KEX_C25519_SHA256] = kex_gen_server; | ||
| server2->kex->kex[KEX_KEM_SNTRUP761X25519_SHA512] = kex_gen_server; |
There was a problem hiding this comment.
bespoke test code for algorithm(s): why?
There was a problem hiding this comment.
This change brings back in the upstream logic explicitly testing the upstream PQ algs. When reviewing this it appears to me no OQS PQ algorithms are being tested currently, so I added templating logic for this in 73875d4. If it seems reasonable I will merge in this logic, or revert if not.
| #define KEX_ECDH_SHA2_NISTP521 "ecdh-sha2-nistp521" | ||
| #define KEX_CURVE25519_SHA256 "curve25519-sha256" | ||
| #define KEX_CURVE25519_SHA256_OLD "curve25519-sha256@libssh.org" | ||
| #define KEX_SNTRUP761X25519_SHA512 "sntrup761x25519-sha512" |
There was a problem hiding this comment.
curious: why are these defines necessary if these algs are available from upstream openssh?
There was a problem hiding this comment.
These defines are still needed in upstream OpenSSH and are used in kex-names.c. The change was to move them out of the OQS template logic, since the entries were removed from generate.yml, to where the defines appear in OpenSSH.
| struct sshbuf **); | ||
| int kex_c25519_dec(struct kex *, const struct sshbuf *, struct sshbuf **); | ||
|
|
||
| int kex_kem_sntrup761x25519_keypair(struct kex *); |
There was a problem hiding this comment.
so these are the upstream names? hence the removal from the generated code?
| "diffie-hellman-group18-sha512," \ | ||
| "diffie-hellman-group14-sha256," \ | ||
| "mlkem768x25519-sha256," \ | ||
| "sntrup761x25519-sha512," \ |
There was a problem hiding this comment.
Only sntrup761x25519 needs the @openssh.com suffix. This algorithm was originally introduced by OpenSSH using the suffix before it was standardized; the plain name was added later as the standard name, and the old @openssh.com name was kept to remain interoperable. mlkem768x25519 was added after this convention and never had a vendor-suffixed predecessor, so it only needs the standard name.
| - if `<SIG>` has L1 security, then the fork provides the methods `rsa3072-<SIG>` and `ecdsa-nistp256-<SIG>`, which combine `<SIG>` with RSA3072 and with ECDSA using NIST's P256 curve respectively. | ||
| - if `<SIG>` has L3 security, the fork provides the method `ecdsa-nistp384-<SIG>`, which combines `<SIG>` with ECDSA using NIST's P384 curve. | ||
| - if `<SIG>` has L5 security, the fork provides the method `ecdsa-nistp521-<SIG>`, which combines `<SIG>` with ECDSA using NIST's P521 curve. | ||
| - NOTE: OpenSSH has added support for the `ssh-mldsa44-ed25519` hybrid signature algorithm in v10.4p1, which is supported in this fork alognside OQS digital signature algorithms. |
There was a problem hiding this comment.
This was something I added to this PR to note the mldsa hybrid was added by OpenSSH, but when updating the upstream KEX algs I saw the "PQ Offered in OpenSSH" section and had thought it was better to just update that section with the new algorithm.
baentsch
left a comment
There was a problem hiding this comment.
Again various comments for understanding; I didn't see anything that would mean this cannot be merged, so feel free to go ahead with that. You've been waiting long enough for a review :-/
| sudo -u builder env VMCI=true WITH_OPENSSL=true bash ./oqs-scripts/build_openssh.sh | ||
| - name: Run tests documented to pass | ||
| shell: netbsd {0} | ||
| # TODO: Investigate further ssh-tty regression test for netbsd. |
There was a problem hiding this comment.
worthwhile creating an issue to not have this comment drown/be forgotten?
There was a problem hiding this comment.
I think the impact of the vm.yml is low enough to not drive a story for this test failure currently. I believe this is a issue with the test environment set up on netbsd and not an issue with the source code.
This ci workflow was added by OpenSSH recently and is still pretty in-progress during uplifts for integration with OQS-SSH. I can ensure this is investigated during the OpenSSH 10.6 uplift, but if it is best practice can also make a story to track this.
| # define USE_SNTRUP761X25519 1 | ||
| /* The ML-KEM768 and ML-DSA implementations also uses C89 features */ | ||
| # define USE_MLKEM768X25519 1 | ||
| // OQS Note: Disabled upstream SNTRUP761X25519 support. |
There was a problem hiding this comment.
Yikes -- this means OQS code may run for these algs if a compiler option is missing. Is there any way to state which crypto lib actually delivers each algorithm?
There was a problem hiding this comment.
The file here is out of date with the latest changes, this logic was inverted to behave like OpenSSH in the commit addressing preferring the OpenSSH implementation of these algorithms. The defines are set to 1 now and OQS code has been removed for these algs.
This comment did lead me to the concern where on any platform that the VLA/mixed-declarations configure checks fail, these algorithms would still be advertised despite not being available causing a negotiation that picks one of these algs to fail unexpectedly. I added guards tomyproposal.h so the algs are only advertised when defined to 1 to try and address this. If this is not in line with the original comment I can make further changes, or revert it altogether.
| _PATH_HOST_MAYO_3_KEY_FILE, 0); | ||
| servconf_add_hostkey("[default]", 0, options, | ||
| _PATH_HOST_MAYO_5_KEY_FILE, 0); | ||
| #ifdef WITH_OPENSSL |
There was a problem hiding this comment.
When I see this define, I've got to ask, which lib provides the crypto (and for which algs) if OpenSSL is present? Is there any way an unwary user can determine this?
There was a problem hiding this comment.
There is currently no way to see this, but it would be possible to add. One thought would be to modify the ssh -Q output to list the lib providing the crypto for the algorithm, where it might look like:
ssh -Q kex-provider
mlkem768x25519-sha256 bundled-libcrux
sntrup761x25519-sha512 openssh-internal
ecdh-sha2-nistp256 openssl default provider
ml-kem-768-sha256@oqs liboqs
or to not diverege with the upstream as much, add a new crypto-provider target (or possibly both)
ssh -Q crypto-provider
ssh-mldsa-44 signature liboqs
ssh-mldsa44-ed25519 signature bundled-libcrux
ssh-rsa keymgmt openssl default provider
mlkem768x25519-sha256 kem bundled-libcrux
Another would be to add a runtime debug/logit call to print the lib in use to the logs.
This would be a more complex change, so I'd prefer to tackle it outside the scope of this PR. Would this be in line with the comment to display the information to users? I can make a story for this and address it before completing the OpenSSH 10.6 uplift.
| " [-m format] [-N new_passphrase] [-O option]\n" | ||
| " [-t ecdsa|ecdsa-sk|ed25519|ed25519-sk|mldsa44-ed25519|rsa]\n" | ||
| " [-t ecdsa|ecdsa-sk|ed25519|ed25519-sk|mldsa44-ed25519|rsa" | ||
| " |\n OQS-fork added algorithms (see README.md)" |
There was a problem hiding this comment.
Again the same question as above: Is there any command that would allow one to see which algs are actually available -- and which crypto lib delivers them? Is it guaranteed that the proper README is available to every user of this program / seeing this output? Wouldn't it be better to generate the real list here (if there's no other way to output the supported algs)?
There was a problem hiding this comment.
My comment here is mostly covered by the response above, but the README is available in the source code for users building OQS-SSH. The complete list of algorithms are also available at runtime through ssh -Q key. I can list out the experimental OQS algorithms if that is preferred though.
| if (id->key != NULL && (id->key->flags & SSHKEY_FLAG_EXT) != 0 && | ||
| // OQS-TODO: for now, our hybrid sig fail that test. Need to fix our formatting | ||
| // or update the test | ||
| if (!oqs_utils_is_hybrid(sign_key->type)) { |
There was a problem hiding this comment.
This does deserve a separate issue to ensure this test disablement is at least tracked.
| #define SSH_VERSION "OpenSSH_10.4-2026-08_" | ||
|
|
||
| #define SSH_PORTABLE "p1" | ||
| #define SSH_RELEASE SSH_VERSION SSH_PORTABLE ", Open Quantum Safe 2026-05" |
There was a problem hiding this comment.
Why no OQS moniker in SSH_VERSION? Why not 2026-08 in SSH_RELEASE?
There was a problem hiding this comment.
When reviewing this comment, I only found a instance of the OQS- prefix in SSH_VERSION in the OQS-v7.9 branch. I had been following what was in the v8 and v9 branches, but would be willing to add the moniker back if you and/or others think that would be clearer.
This may have been updated after the initial comment but '2026-08' is present in SSH_RELEASE now.
Signed-off-by: Andrew Younkers <ayounkers44@gmail.com>
Signed-off-by: Andrew Younkers <ayounkers44@gmail.com>
There was a problem hiding this comment.
Thank you for the comments @baentsch. I have either pushed up changes requested or responded to all discussions. There are a few threads I would like further feedback on :)
| #endif /* OPENSSL_HAS_ECC */ | ||
| #endif /* WITH_OPENSSL */ | ||
| server2->kex->kex[KEX_C25519_SHA256] = kex_gen_server; | ||
| server2->kex->kex[KEX_KEM_SNTRUP761X25519_SHA512] = kex_gen_server; |
There was a problem hiding this comment.
This change brings back in the upstream logic explicitly testing the upstream PQ algs. When reviewing this it appears to me no OQS PQ algorithms are being tested currently, so I added templating logic for this in 73875d4. If it seems reasonable I will merge in this logic, or revert if not.
| #define KEX_ECDH_SHA2_NISTP521 "ecdh-sha2-nistp521" | ||
| #define KEX_CURVE25519_SHA256 "curve25519-sha256" | ||
| #define KEX_CURVE25519_SHA256_OLD "curve25519-sha256@libssh.org" | ||
| #define KEX_SNTRUP761X25519_SHA512 "sntrup761x25519-sha512" |
There was a problem hiding this comment.
These defines are still needed in upstream OpenSSH and are used in kex-names.c. The change was to move them out of the OQS template logic, since the entries were removed from generate.yml, to where the defines appear in OpenSSH.
| struct sshbuf **); | ||
| int kex_c25519_dec(struct kex *, const struct sshbuf *, struct sshbuf **); | ||
|
|
||
| int kex_kem_sntrup761x25519_keypair(struct kex *); |
| "diffie-hellman-group18-sha512," \ | ||
| "diffie-hellman-group14-sha256," \ | ||
| "mlkem768x25519-sha256," \ | ||
| "sntrup761x25519-sha512," \ |
There was a problem hiding this comment.
Only sntrup761x25519 needs the @openssh.com suffix. This algorithm was originally introduced by OpenSSH using the suffix before it was standardized; the plain name was added later as the standard name, and the old @openssh.com name was kept to remain interoperable. mlkem768x25519 was added after this convention and never had a vendor-suffixed predecessor, so it only needs the standard name.
| - if `<SIG>` has L1 security, then the fork provides the methods `rsa3072-<SIG>` and `ecdsa-nistp256-<SIG>`, which combine `<SIG>` with RSA3072 and with ECDSA using NIST's P256 curve respectively. | ||
| - if `<SIG>` has L3 security, the fork provides the method `ecdsa-nistp384-<SIG>`, which combines `<SIG>` with ECDSA using NIST's P384 curve. | ||
| - if `<SIG>` has L5 security, the fork provides the method `ecdsa-nistp521-<SIG>`, which combines `<SIG>` with ECDSA using NIST's P521 curve. | ||
| - NOTE: OpenSSH has added support for the `ssh-mldsa44-ed25519` hybrid signature algorithm in v10.4p1, which is supported in this fork alognside OQS digital signature algorithms. |
There was a problem hiding this comment.
This was something I added to this PR to note the mldsa hybrid was added by OpenSSH, but when updating the upstream KEX algs I saw the "PQ Offered in OpenSSH" section and had thought it was better to just update that section with the new algorithm.
| # define USE_SNTRUP761X25519 1 | ||
| /* The ML-KEM768 and ML-DSA implementations also uses C89 features */ | ||
| # define USE_MLKEM768X25519 1 | ||
| // OQS Note: Disabled upstream SNTRUP761X25519 support. |
There was a problem hiding this comment.
The file here is out of date with the latest changes, this logic was inverted to behave like OpenSSH in the commit addressing preferring the OpenSSH implementation of these algorithms. The defines are set to 1 now and OQS code has been removed for these algs.
This comment did lead me to the concern where on any platform that the VLA/mixed-declarations configure checks fail, these algorithms would still be advertised despite not being available causing a negotiation that picks one of these algs to fail unexpectedly. I added guards tomyproposal.h so the algs are only advertised when defined to 1 to try and address this. If this is not in line with the original comment I can make further changes, or revert it altogether.
| if (id->key != NULL && (id->key->flags & SSHKEY_FLAG_EXT) != 0 && | ||
| // OQS-TODO: for now, our hybrid sig fail that test. Need to fix our formatting | ||
| // or update the test | ||
| if (!oqs_utils_is_hybrid(sign_key->type)) { |
| _PATH_HOST_MAYO_3_KEY_FILE, 0); | ||
| servconf_add_hostkey("[default]", 0, options, | ||
| _PATH_HOST_MAYO_5_KEY_FILE, 0); | ||
| #ifdef WITH_OPENSSL |
There was a problem hiding this comment.
There is currently no way to see this, but it would be possible to add. One thought would be to modify the ssh -Q output to list the lib providing the crypto for the algorithm, where it might look like:
ssh -Q kex-provider
mlkem768x25519-sha256 bundled-libcrux
sntrup761x25519-sha512 openssh-internal
ecdh-sha2-nistp256 openssl default provider
ml-kem-768-sha256@oqs liboqs
or to not diverege with the upstream as much, add a new crypto-provider target (or possibly both)
ssh -Q crypto-provider
ssh-mldsa-44 signature liboqs
ssh-mldsa44-ed25519 signature bundled-libcrux
ssh-rsa keymgmt openssl default provider
mlkem768x25519-sha256 kem bundled-libcrux
Another would be to add a runtime debug/logit call to print the lib in use to the logs.
This would be a more complex change, so I'd prefer to tackle it outside the scope of this PR. Would this be in line with the comment to display the information to users? I can make a story for this and address it before completing the OpenSSH 10.6 uplift.
| " [-m format] [-N new_passphrase] [-O option]\n" | ||
| " [-t ecdsa|ecdsa-sk|ed25519|ed25519-sk|mldsa44-ed25519|rsa]\n" | ||
| " [-t ecdsa|ecdsa-sk|ed25519|ed25519-sk|mldsa44-ed25519|rsa" | ||
| " |\n OQS-fork added algorithms (see README.md)" |
There was a problem hiding this comment.
My comment here is mostly covered by the response above, but the README is available in the source code for users building OQS-SSH. The complete list of algorithms are also available at runtime through ssh -Q key. I can list out the experimental OQS algorithms if that is preferred though.
| sudo -u builder env VMCI=true WITH_OPENSSL=true bash ./oqs-scripts/build_openssh.sh | ||
| - name: Run tests documented to pass | ||
| shell: netbsd {0} | ||
| # TODO: Investigate further ssh-tty regression test for netbsd. |
There was a problem hiding this comment.
I think the impact of the vm.yml is low enough to not drive a story for this test failure currently. I believe this is a issue with the test environment set up on netbsd and not an issue with the source code.
This ci workflow was added by OpenSSH recently and is still pretty in-progress during uplifts for integration with OQS-SSH. I can ensure this is investigated during the OpenSSH 10.6 uplift, but if it is best practice can also make a story to track this.
The existing Focal image uses GCC 9, which cannot compile the SNOVA Round 3 AVX2 implementation currently on liboqs main. Use the OQS Jammy CI image, which is maintained by the OQS project and provides the newer compiler used by current liboqs CI. Signed-off-by: Andrew Younkers <ayounkers44@gmail.com>
This PR merges in upstream commits from the OpenSSH-portable V_10_4_P1 tag by running a git merge V_10_4_P1. The main changes that I noticed during the uplift causing conflicts had to do with the upstream addition of enabling the
ssh-mldsa44-ed25519hybrid signature algorithm.All merge conflict resolutions are shown in commit: 1dc4dc1. I used the following methodology to resolve all merge conflicts
In the past OQS-SSH has rejected upstream OpenSSH hybrid PQ algorithms due to them already being implemented in the project, but this is a case where the upstream is adding a new algorithm the project doesn't already support. Since there was no conflict in bringing in this new algorithm, I kept the upstream code enabled and as such
ssh-mldsa44-ed25519@openssh.comis now available in this project. I added a note to the README to address this in the following commit: 1ef3c3a.